VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmINV160 
   BackColor       =   &H8000000D&
   Caption         =   " INV160"
   ClientHeight    =   6120
   ClientLeft      =   1230
   ClientTop       =   1515
   ClientWidth     =   9690
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   6120
   ScaleWidth      =   9690
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   372
      Left            =   6240
      Top             =   840
      Visible         =   0   'False
      Width           =   1572
      _ExtentX        =   2778
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CheckBox chkTCEFI 
      Enabled         =   0   'False
      Height          =   192
      Left            =   2520
      TabIndex        =   38
      Top             =   4440
      Width           =   180
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   3888
      Left            =   495
      TabIndex        =   10
      Top             =   1440
      Width           =   8268
      Begin VB.CheckBox chkTCEFP 
         Enabled         =   0   'False
         Height          =   192
         Left            =   2028
         TabIndex        =   36
         Top             =   3315
         Width           =   180
      End
      Begin VB.CheckBox chkTCEFA 
         Enabled         =   0   'False
         Height          =   192
         Left            =   2028
         TabIndex        =   34
         Top             =   1956
         Width           =   180
      End
      Begin VB.CheckBox chkTCEFS 
         Enabled         =   0   'False
         Height          =   192
         Left            =   5784
         TabIndex        =   32
         Top             =   2940
         Width           =   180
      End
      Begin VB.CheckBox chkTCEFR 
         Enabled         =   0   'False
         Height          =   192
         Left            =   2028
         TabIndex        =   30
         Top             =   2700
         Width           =   180
      End
      Begin VB.CheckBox chkTCEFO 
         Enabled         =   0   'False
         Height          =   192
         Left            =   2028
         TabIndex        =   28
         Top             =   2328
         Width           =   180
      End
      Begin VB.CheckBox chkTCEFC 
         Enabled         =   0   'False
         Height          =   192
         Left            =   5784
         TabIndex        =   26
         Top             =   3312
         Width           =   180
      End
      Begin VB.CheckBox chkTCCYN 
         Enabled         =   0   'False
         Height          =   192
         Left            =   5784
         TabIndex        =   24
         Top             =   2556
         Width           =   180
      End
      Begin VB.TextBox txtTCCVL 
         Enabled         =   0   'False
         Height          =   288
         Left            =   5796
         TabIndex        =   21
         Top             =   912
         Width           =   1884
      End
      Begin VB.TextBox txtTCRLB 
         Enabled         =   0   'False
         Height          =   288
         Left            =   5784
         TabIndex        =   19
         Top             =   492
         Width           =   1884
      End
      Begin VB.TextBox txtTCCLB 
         Enabled         =   0   'False
         Height          =   288
         Left            =   2004
         TabIndex        =   17
         Top             =   924
         Width           =   1884
      End
      Begin VB.TextBox txtTCDLB 
         Enabled         =   0   'False
         Height          =   288
         Left            =   1992
         TabIndex        =   15
         Top             =   504
         Width           =   1884
      End
      Begin VB.TextBox txtTCDSC 
         Enabled         =   0   'False
         Height          =   276
         Left            =   5796
         MultiLine       =   -1  'True
         TabIndex        =   14
         Top             =   96
         Width           =   1932
      End
      Begin VB.TextBox txtTCTTC 
         Enabled         =   0   'False
         Height          =   288
         Left            =   2004
         TabIndex        =   13
         Top             =   72
         Width           =   756
      End
      Begin VB.Label Label1 
         BackColor       =   &H00E0E0E0&
         Caption         =   "Effect Issued"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   255
         TabIndex        =   39
         Top             =   3000
         Width           =   1560
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect On Order"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   225
         Index           =   16
         Left            =   255
         TabIndex        =   37
         Top             =   3315
         Width           =   1575
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect Adjust"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   225
         Index           =   15
         Left            =   255
         TabIndex        =   35
         Top             =   1950
         Width           =   1590
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect Sold"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   14
         Left            =   4560
         TabIndex        =   33
         Top             =   2940
         Width           =   1008
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect Receipt"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   225
         Index           =   13
         Left            =   255
         TabIndex        =   31
         Top             =   2700
         Width           =   1665
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect open Bal"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   225
         Index           =   12
         Left            =   255
         TabIndex        =   29
         Top             =   2325
         Width           =   1620
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect cost"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   11
         Left            =   4584
         TabIndex        =   27
         Top             =   3312
         Width           =   1008
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Cost Entry"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   10
         Left            =   4572
         TabIndex        =   25
         Top             =   2556
         Width           =   1008
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Effect"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   -1  'True
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   9
         Left            =   216
         TabIndex        =   23
         Top             =   1548
         Width           =   564
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Cust/Vendor Label"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   8
         Left            =   3960
         TabIndex        =   22
         Top             =   972
         Width           =   1728
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Reference Label"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   7
         Left            =   4152
         TabIndex        =   20
         Top             =   552
         Width           =   1452
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Value Label"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   6
         Left            =   696
         TabIndex        =   18
         Top             =   984
         Width           =   1056
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Document Label"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   4
         Left            =   324
         TabIndex        =   16
         Top             =   564
         Width           =   1452
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Transaction code"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   5
         Left            =   240
         TabIndex        =   12
         Top             =   144
         Width           =   1572
      End
      Begin VB.Label lbl 
         BackStyle       =   0  'Transparent
         Caption         =   "Description"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   7.5
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   228
         Index           =   3
         Left            =   4572
         TabIndex        =   11
         Top             =   108
         Width           =   1092
      End
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "&Delete"
      Height          =   372
      Left            =   5055
      TabIndex        =   7
      Top             =   5544
      Width           =   960
   End
   Begin VB.CommandButton cmdAddnew 
      Caption         =   "&New Transaction"
      Height          =   372
      Left            =   495
      TabIndex        =   4
      Top             =   5544
      Width           =   1365
   End
   Begin VB.CommandButton cmdEdit 
      Caption         =   "&Edit"
      Height          =   372
      Left            =   1890
      TabIndex        =   3
      Top             =   5544
      Width           =   948
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "&Save"
      Height          =   372
      Left            =   2925
      TabIndex        =   2
      Top             =   5544
      Width           =   984
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "&Cancel"
      Height          =   372
      Left            =   3960
      TabIndex        =   1
      Top             =   5544
      Width           =   1032
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      Height          =   372
      Left            =   6075
      TabIndex        =   0
      Top             =   5544
      Width           =   1080
   End
   Begin MSDataListLib.DataCombo cboTCTTC 
      Bindings        =   "frmINV160.frx":0000
      Height          =   288
      Left            =   3396
      TabIndex        =   8
      Top             =   1008
      Width           =   2256
      _ExtentX        =   3995
      _ExtentY        =   556
      _Version        =   393216
      ListField       =   "tcdsc"
      BoundColumn     =   "tcttc"
      Text            =   ""
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Select Transaction Type"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   7.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0080FFFF&
      Height          =   225
      Index           =   2
      Left            =   1125
      TabIndex        =   9
      Top             =   1035
      Width           =   2130
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "INV160"
      BeginProperty Font 
         Name            =   "VNI-Present"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   468
      Index           =   0
      Left            =   36
      TabIndex        =   6
      Top             =   24
      Width           =   1680
   End
   Begin VB.Label lbl 
      BackStyle       =   0  'Transparent
      Caption         =   "Transaction Effect Code Mainternence"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   16.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   495
      Index           =   1
      Left            =   1770
      TabIndex        =   5
      Top             =   420
      Width           =   7710
   End
End
Attribute VB_Name = "frmINV160"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim OldTCTTC As String
Sub ButtonStatus()
cmdAddnew.Enabled = Not ISEDITING
cmdEdit.Enabled = Not ISEDITING
cmdSave.Enabled = ISEDITING ' And txtIMITN <> ""
cmdDelete.Enabled = Not ISEDITING 'And txtIMITN <> ""
cmdCancel.Enabled = ISEDITING
'txtTCTTC.Locked = Not ISADDING ' Lock item code tru truong hop ISADDING=true
'txtDepartment.Enabled = ISEDITING
'cboDepartment.Visible = Not ISADDING
'txtDepartmentID.Visible = ISADDING
End Sub

Private Sub cboTCTTC_Click(Area As Integer)
If Area = 2 Then
    WriteToScreen (1)
End If

End Sub

Private Sub chkTCEFA_Click()
    
    If chkTCEFA.value = 1 Then
        chkTCEFI.value = 0
        chkTCEFO.value = 0
        chkTCEFR.value = 0
        chkTCEFP.value = 0
    End If
End Sub

Private Sub chkTCEFI_Click()
 If chkTCEFI.value = 1 Then
        chkTCEFA.value = 0
        chkTCEFO.value = 0
        chkTCEFR.value = 0
        chkTCEFP.value = 0
    End If
End Sub

Private Sub chkTCEFO_Click()
 If chkTCEFO.value = 1 Then
        chkTCEFA.value = 0
        chkTCEFI.value = 0
        chkTCEFR.value = 0
        chkTCEFP.value = 0
    End If
End Sub

Private Sub chkTCEFP_Click()
 If chkTCEFP.value = 1 Then
        chkTCEFI.value = 0
        chkTCEFO.value = 0
        chkTCEFR.value = 0
        chkTCEFA.value = 0
    End If
End Sub

Private Sub chkTCEFR_Click()
 If chkTCEFR.value = 1 Then
        chkTCEFI.value = 0
        chkTCEFO.value = 0
        chkTCEFA.value = 0
        chkTCEFP.value = 0
    End If
End Sub

Private Sub cmdAddnew_Click()
ISADDING = True
ISEDITING = True
WriteToScreen (0)
Control (True)
' Ham Gan tri man hinh
ButtonStatus

End Sub

Private Sub cmdCancel_Click()
' Gan tri man nhinh
ISADDING = False
ISEDITING = False
Control (False)
ButtonStatus
txtTCTTC = cboTCTTC.BoundText
WriteToScreen (1)
End Sub

Private Sub cmdDelete_Click()
ISADDING = False
ISEDITING = False
' Ham delete theo Item chon
Dim SQL As String
SQL = "DELETE FROM ITC WHERE TCTTC = '" & cboTCTTC.BoundText & "'"

Set cmdExecute = New ADODB.Command
Set cmdExecute.ActiveConnection = DBconn
cmdExecute.CommandText = SQL
cmdExecute.Execute
Adodc1.Refresh
WriteToScreen (0)
ButtonStatus

End Sub

Private Sub cmdEdit_Click()

' Ham gan tri man hinh
ISADDING = False
ISEDITING = True
Control (True)

ButtonStatus

End Sub

Private Sub Control(GT As Variant)
    
    txtTCTTC.Enabled = GT
    txtTCDLB.Enabled = GT
    txtTCCLB.Enabled = GT
    txtTCDSC.Enabled = GT
    txtTCRLB.Enabled = GT
    txtTCCVL.Enabled = GT
    chkTCEFA.Enabled = GT
    chkTCEFO.Enabled = GT
    chkTCEFR.Enabled = GT
    chkTCCYN.Enabled = GT
    chkTCEFS.Enabled = GT
    chkTCEFP.Enabled = GT
    chkTCEFC.Enabled = GT
    chkTCEFI.Enabled = GT
    
 '   txtTCTTC.Locked = Not GT
'    txtTCDLB.Locked = Not GT
    'txtTCCLB.Locked = Not GT
   ' txtTCDSC.Locked = Not GT
  '  txtTCRLB.Locked = Not GT
 '   txtTCCVL.Locked = Not GT
'    chkTCEFA.Locked = Not GT
'    chkTCEFO.Locked = Not GT
'    chkTCEFR.Locked = Not GT
'    chkTCCYN.Locked = Not GT
'    chkTCEFS.Locked = Not GT
'    chkTCEFP.Locked = Not GT
'    chkTCEFC.Locked = Not GT
'    chkTCEFI.Locked = Not GT
    
    cboTCTTC.Enabled = Not GT
    cboTCTTC.Locked = GT
End Sub
Private Sub WriteToScreen(tri As Byte)
If tri = 0 Then 'gan rong
        txtTCTTC = ""
        txtTCDLB = ""
        txtTCCLB = ""
        txtTCDSC = ""
        txtTCRLB = ""
        txtTCCVL = ""
        chkTCEFA.value = 0
        chkTCEFO.value = 0
        chkTCEFR.value = 0
        chkTCCYN.value = 0
        chkTCEFS.value = 0
        chkTCEFP.value = 0
        chkTCEFC.value = 0
        chkTCEFI.value = 0
Else
        Dim TBL As ADODB.Recordset
        Set TBL = New ADODB.Recordset
        TBL.Open "  Select ITC.*From ITC where  TCTTC ='" & cboTCTTC.BoundText & "'", DBconn, adOpenKeyset, adLockOptimistic, adCmdText
        If TBL.EOF = False Then
            txtTCTTC = IIf(IsNull(TBL!TCTTC), "", TBL!TCTTC)
            txtTCDLB = IIf(IsNull(TBL!tcdlb), "", TBL!tcdlb)
            txtTCCLB = IIf(IsNull(TBL!tcclb), "", TBL!tcclb)
            txtTCDSC = IIf(IsNull(TBL!TCDSC), "", TBL!TCDSC)
            txtTCRLB = IIf(IsNull(TBL!tcrlb), "", TBL!tcrlb)
            txtTCCVL = IIf(IsNull(TBL!tccvl), "", TBL!tccvl)
            chkTCEFA.value = IIf(TBL!TCEFA, 1, 0)
            chkTCEFO.value = IIf(TBL!TCEFO, 1, 0)
            chkTCEFR.value = IIf(TBL!TCEFR, 1, 0)
            chkTCCYN.value = IIf(TBL!TCCYN, 1, 0)
            chkTCEFS.value = IIf(TBL!TCEFS, 1, 0)
            chkTCEFP.value = IIf(TBL!TCEFP, 1, 0)
            chkTCEFC.value = IIf(TBL!TCEFC, 1, 0)
            chkTCEFI.value = IIf(TBL!TCEFI, 1, 0)
        Else
            txtTCTTC = ""
            txtTCDLB = ""
            txtTCCLB = ""
            txtTCDSC = ""
            txtTCRLB = ""
            txtTCCVL = ""
            chkTCEFA.value = 0
            chkTCEFO.value = 0
            chkTCEFR.value = 0
            chkTCCYN.value = 0
            chkTCEFS.value = 0
            chkTCEFP.value = 0
            chkTCEFC.value = 0
            chkTCEFI.value = 0
        End If
        TBL.Close
End If
OldTCTTC = txtTCTTC
End Sub
Private Sub WriteToFile(tri As Byte)
Dim SQLInsert As String
If tri = 0 Then
    SQLInsert = " INSERT INTO ITC " & _
                  "(TCTTC,TCDLB,TCCLB,TCDSC,TCRLB,TCCVL,TCEFA,TCEFO,TCEFR,TCCYN, " & _
                  "TCEFS,TCEFP,TCEFC,TCEFI)" & _
                "VALUES " & _
                  "('" & Left(txtTCTTC, 2) & "', '" & Left(txtTCDLB, 20) & "', " & _
                  "'" & Left(txtTCCLB, 20) & "', '" & Left(txtTCDSC, 30) & "', '" & _
                  Left(txtTCRLB, 20) & "', '" & Left(txtTCCVL, 20) & "', " & chkTCEFA & _
                  ", " & chkTCEFO & ", " & chkTCEFR & ", " & chkTCCYN & ", " & chkTCEFS & _
                  ", " & chkTCEFP & ", " & chkTCEFC & ", " & chkTCEFI & ")"
 Else
    SQLInsert = "UPDATE ITC SET " & _
             " TCTTC ='" & Left(txtTCTTC, 2) & "', TCDLB ='" & Left(txtTCCLB, 20) & "', " & _
             "TCCLB ='" & Left(txtTCCLB, 20) & "', TCDSC ='" & Left(txtTCDSC, 30) & "', " & _
             "TCRLB = '" & Left(txtTCRLB, 20) & "', TCCVL = '" & Left(txtTCCVL, 20) & "', " & _
             "TCEFA =" & chkTCEFA.value & ", TCEFO =" & chkTCEFO.value & ", " & _
             "TCEFR =" & chkTCEFR.value & ", TCCYN = " & chkTCCYN.value & ", " & _
             "TCEFS =" & chkTCEFS.value & ", TCEFP =" & chkTCEFP.value & ", " & _
             "TCEFC =" & chkTCEFC.value & ", TCEFI =" & chkTCEFI.value & _
             " WHERE TCTTC ='" & OldTCTTC & "'"
         
End If
'MsgBox SQLInsert
DBconn.Execute SQLInsert

End Sub

Private Sub cmdExit_Click()
Unload frmINV160
End Sub
Private Sub cmdSave_Click()
' Ham Save tri vao file
Dim tbl_ChapNhan As ADODB.Recordset
Set tbl_ChapNhan = New ADODB.Recordset
tbl_ChapNhan.Open "  Select IIM.*From IIM ", DBconn, adOpenKeyset, adLockOptimistic, adCmdText
tbl_ChapNhan.Close
If ISADDING = False Then
    WriteToFile (1)
Else
    WriteToFile (0)
End If
Adodc1.Refresh
Control (False)
'''''''''''
ISADDING = False
ISEDITING = False

ButtonStatus

End Sub

Private Sub Form_Load()
BIENCHUNG
Adodc1.ConnectionString = ConnectString
Adodc1.ConnectionTimeout = 10
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "ITC" 'transtion
Adodc1.Refresh

ISADDING = False
ISEDITING = False
ButtonStatus
End Sub

Private Sub txtTCTTC_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If ValidMaso(OldTCTTC, txtTCTTC, "ITC", " TCTTC='" & txtTCTTC & "'") Then
        MsgBox "This code is already exist"
        txtTCTTC.SetFocus
    Else
        txtTCDSC.SetFocus
    End If
End If
End Sub
